using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;
using WindowsPhoneGame1.GamePlayStates;

namespace WindowsPhoneGame1.GameScreens
{
    public class SplashScreen : Screen
    {
        private Texture2D background, background2;
        private double secondsToMenu;
        private double secondsToSwitch;
        private bool switched = false;

        public SplashScreen(Game1 game, float secondsToMenu) : base(game)
        {
            NUMBER_OF_BUTTONS = 0;
            this.secondsToMenu = secondsToMenu;
            secondsToSwitch = secondsToMenu / 2;
        }
        
        public override void Initialize()
        {
            base.Initialize();
        }

        public override void LoadContent()
        {
            background = game.Content.Load<Texture2D>("images/Splash");
            background2 = game.Content.Load<Texture2D>("images/Logo");
            base.LoadContent();
        }

        public override void UnloadContent()
        {
            base.UnloadContent();
        }

        public override void Update(GameTime gameTime)
        {
            secondsToMenu -= gameTime.ElapsedGameTime.TotalSeconds;
            secondsToSwitch -= gameTime.ElapsedGameTime.TotalSeconds;
            if (secondsToMenu < 0)
                game.SetScreen(new MainMenuScreen(game));
            if (!switched && secondsToSwitch < 0)
                background = background2;
            base.Update(gameTime);
        }

        public override void Draw(GameTime gameTime)
        {
            game.GraphicsDevice.Clear(background_color);
            

            game.SpriteBatch.Draw(background, game.GraphicsDevice.Viewport.Bounds, Color.White);
            

            base.Draw(gameTime);
        }

    }
}
